package org.cw.action;

import org.cw.exception.ServiceException;
import org.cw.service.ExampleService;
import org.cw.vo.ExampleVo;

public class ExampleAction extends BasicAction
{
	private ExampleVo exampleVo;
	private ExampleService exampleService;
	
	public ExampleService getExampleService() {
		return exampleService;
	}

	public void setExampleService(ExampleService exampleService) {
		this.exampleService = exampleService;
	}

	public ExampleVo getExampleVo() {
		return exampleVo;
	}

	public void setExampleVo(ExampleVo exampleVo) {
		this.exampleVo = exampleVo;
	}

	public String insert()
	{
		session.put("name", exampleVo.getName());
		System.out.println(exampleVo.getName());
		try {
			exampleService.insert(exampleVo);
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return SUCCESS;
	}
	
	public String queryByName()
	{
		System.out.println(exampleVo.getName());
		try {
			exampleService.queryByName(exampleVo.getName());
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return SUCCESS;
	}
}
